package com.itheima.appserver.controller;

import com.itheima.appserver.service.PeachBlossomService;
import com.itheima.commons.vo.reception.PeachVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping
public class PeachBlossomController {

    @Autowired
    PeachBlossomService peachBlossomService;

    @GetMapping("peachblossom")
    public ResponseEntity receiveSound(){
        PeachVo peachVo=peachBlossomService.receiveSound();
        return ResponseEntity.ok(peachVo);
    }

    @PostMapping("peachblossom")
    public ResponseEntity sendSound(@RequestParam("soundFile")MultipartFile soundsFile){
        peachBlossomService.uploadSounds(soundsFile);
        return ResponseEntity.ok(null);
    }

}
